package pl.put.augrelshooter.adapters;

import pl.put.augrelshooter.R;
import pl.put.augrelshooter.adapters.items.MainMenuItem;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

public class MainMenuAdapter extends ArrayAdapter<MainMenuItem> {

	private final Context context;
	private final MainMenuItem[] values;

	public MainMenuAdapter(Context context, MainMenuItem[] values) {
		super(context, R.layout.main_menu_list_item, values);

		this.context = context;
		this.values = values;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		View rowView = inflater.inflate(R.layout.main_menu_list_item, parent, false);
		TextView textView = (TextView) rowView.findViewById(R.id.label);
		textView.setText(values[position].getName());
		textView.setCompoundDrawables(null, null, null, null);

		return rowView;
	}

}
